#include <iostream>
#include <stdlib.h>

#include "raytracing.h"
#include "esfera.h"
#include "triangulo.h"
#include "ray.h"
#include "sistemaslineares.h"
#include "matrix3d.h"
#include "luz.h"
#include "intersectobject.h"
#include "camera.h"
#include "color.h"
#include "image.h"
#include "mundo.h"
#include "vector.h"

using std::cout;

/*
void printPosicao(Matrix3D *posicao) {
	int i,j;

	for (i = 0;i < 3;i++) {
		for (j = 0;j < 3;j++) {
			cout << posicao->getCoord(i,j) << "\t";
		}
		cout << "\n";
	}
}
*/
int main(int argc, char *argv) {
	
	/*Color *c = new Color(10,30,24);
	Vector *posCamera = new Vector(40,34,34);
	Vector *dirCamera = new Vector(40,49,34);
	Vector *origemPlano = new Vector(2,4,3);
	Vector *up = new Vector(8,15,48);
	Vector eixoX(1,0,0),eixoY(0,1,0),eixoZ(0,0,1);
	float delta = 5;
	Camera *camera = new Camera(posCamera,dirCamera,origemPlano,up,&eixoX,&eixoY,&eixoZ,delta);
	Vector *posLuz = new Vector(3,45,40);
	Color *corLuz = new Color(255,255,255);
	Luz *luz = new Luz(posLuz,corLuz);
	Mundo *m = new Mundo(c,luz);*/
	
	//Camera *c = new Camera(new Vector(2,2,2),new Vector(2,2,0),
	
	/*Esfera *f = new Esfera(new Color(24,494,249),new Vector(4.0,1.0,4.0),0.2,0.2,0.1,0.001,3);
	
	f->rotacionar(30,0,0);
	f->orientacao->print(); cout << "\n";
	f->rotacionar(0,30,0);
	f->orientacao->print(); cout << "\n";
	f->rotacionar(0,0,30);
	f->orientacao->print();
	*/
	//cout << "\n";

	Luz *luz = new Luz(new Vector(0,0,0),new Color(255,255,255),150);
	
	Mundo *mundo = new Mundo(new Color(30,30,30),luz);
	Camera *camera = new Camera(new Vector(0,0,0),new Vector(1,0,0),new Vector(0,0,1),NULL,NULL,NULL,1.5);
	//Esfera *esfera = new Esfera(new Color(0,255,255),new Vector(3,-180,-50),0.3,0.2,0.9,3,2);
	Triangulo *triangulo = new Triangulo(new Vector(7,-120,0),new Vector(7,120,0),new Vector(7,0,100),new Color(0,255,0),0.3,0.4,0.9,3);
	
	//mundo->addObjeto(esfera);
	mundo->addObjeto(triangulo);
	
	RayTracing *rt = new RayTracing(mundo,camera,100,100);
	rt->render(0,0,100,100);

    //system("PAUSE");	
	return 0;
}
